#include "widget.h"
#include "ui_widget.h"
#include <QSpacerItem>
#include <QHBoxLayout>
#include <QPushButton>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    QHBoxLayout* layout = new QHBoxLayout();
    this->setLayout(layout);

    QPushButton* button1 = new QPushButton("按钮1");
    QPushButton* button2 = new QPushButton("按钮2");
    QSpacerItem* space = new QSpacerItem(200,10);

    layout->addWidget(button1);
    layout->addSpacerItem(space);
    layout->addWidget(button2);
    layout->setStretch(0,1);
    layout->setStretch(2,2);
}

Widget::~Widget()
{
    delete ui;
}

